//
//  PurchaseOfferTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/3.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "PurchaseOfferTableViewCell.h"
#import "PurchaseGoodsView.h"

@interface PurchaseOfferTableViewCell (){
    GLGWLabel * nameLabel;
    GLGWLabel * timelabel;
}
@end

@implementation PurchaseOfferTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        GLGWView * bankgroundView = [[GLGWView alloc] initWithInSuperView:self.contentView];
        bankgroundView.backgroundColor = [UIColor whiteColor];
        [bankgroundView setViewShadowWidth:3.0 theCornerRadius:3.0];
        [bankgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.contentView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.bottom.equalTo(self.contentView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(10));
        }];
        //
        GLGWImageView * rightImageView = [[GLGWImageView alloc] initWithImageName:@"icon_chakan" inSuperView:bankgroundView];
//        rightImageView.backgroundColor = kRandomColor;
        [rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(bankgroundView);
            make.right.equalTo(bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(10));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(14)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(15)));
        }];
        
        CGFloat goodsWedth =(KScreenWidth - kWidthProportion_In_iPhoneTriploid(80))/3;
        for (int i = 0; i < 3; i++) {
            PurchaseGoodsView * goodsView = [[PurchaseGoodsView alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(10)+kWidthProportion_In_iPhoneTriploid(10)*i+goodsWedth*i, kHeightProportion_In_iPhoneTriploid(15), goodsWedth, kHeightProportion_In_iPhoneTriploid(47)) inSuperView:bankgroundView];
        }
        //
        nameLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:kColor_Rule_Black inSuperView:bankgroundView];
        nameLabel.text = @"张海涛";
        [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(bankgroundView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.bottom.equalTo(bankgroundView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(15));
        }];
        //
        timelabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:bankgroundView];
        timelabel.text = @"2018-08-21 12:12:12";
        [timelabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(20));
            make.bottom.equalTo(bankgroundView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(15));
        }];
    }
    return self;
}

- (void)setInfoModel:(PurchaseInformationDataInfosModel *)infoModel
{
    _infoModel = infoModel;
    
}
@end
